<template>
    <a-modal title="查看意见" width="1000px" :visible="visible" @ok="handleCancel" @cancel="handleCancel">
        <div class="options">
            <a-table
                ref="table"
                :scroll="{y: 500}"
                bordered
                rowKey="id"
                :columns="columns"
                :dataSource="dataSource"
                :pagination="false"
            >
            </a-table>
        </div>
    </a-modal>
</template>
<script>
import { cxjCgCxjglCxjpltjAddTjyj } from '@/api/api'
export default {
    name: 'OptionsModal',
    props: ['showFlag', 'cxj_cxj_id'],
    data() {
        return {
            visible: false,
            columns: [
                {
                    title: '时间',
                    align: "center",
                    dataIndex: 'create_time',
                    customRender: function(create_time){
                        return create_time || '--'
                    }
                },
                {
                    title: '操作人',
                    align: "center",
                    dataIndex: 'tjr',
                    customRender: function(tjr){
                        return tjr || '--'
                    }
                },
                {
                    title: '推荐状态',
                    align: "center",
                    dataIndex: 'tjyj_sftj',
                    customRender: function(tjyj_sftj){
                        return tjyj_sftj || '--'
                    }
                },
                {
                    title: '推荐意见',
                    align: "center",
                    dataIndex: 'tjyj_yj',
                    customRender: function(tjyj_yj){
                        return tjyj_yj || '--'
                    }
                },
            ],
            dataSource: []
        }
    },
    watch: {
        showFlag(newVal, oldVal) {
            if (newVal != oldVal) {
                this.visible = true;
                this.fetchList()
            }
        }
    },
    methods: {
        fetchList() {
            cxjCgCxjglCxjpltjAddTjyj({
                cxj_cxj_id: this.cxj_cxj_id
            }).then(res => {
                if (res.success) {
                    this.dataSource = res.result.records;
                }
            })
        },
        handleCancel() {
            this.dataSource = []
            this.visible = false
        }
    },
}
</script>
<style lang="less" scoped></style>
